package org.jetlinks.pro.koudai.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
import org.hswebframework.ezorm.rdb.mapping.annotation.JsonCodec;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.sql.JDBCType;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 实验项目信息
 *
 * @author zhoukun
 * @since 1.3
 */
@Getter
@Setter
@Table(name = "k_taked_experiment", indexes = {
    @Index(name = "idx_taked_experiment_id", columnList = "id")
})
public class TakedExperimentEntity extends GenericEntity<String> {
    @Override
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @Schema(description = "ID")
    public String getId() {
        return super.getId();
    }


    @Column(length = 64, nullable = false)
    @NotBlank(message = "[key]不能为空", groups = CreateGroup.class)
    @Schema(description = "实验Id")
    private String experimentId;

    @Column(length = 64, nullable = false)
    @NotBlank(message = "[key]不能为空", groups = CreateGroup.class)
    @Schema(description = "实验班级id-机构")
    private String experimentClassId;

    @Column(length = 64, nullable = false)
    @NotBlank(message = "[key]不能为空", groups = CreateGroup.class)
    @Schema(description = "实验所属学生id-用户")
    private String experimentStudentId;

    @Column(length = 64)
    @Schema(description = "创建学校-机构")
    private String createSchoolBy;

    @Column(length = 64)
    @Schema(description = "创建教师-用户")
    private String createTeacherBy;

    @Column(length = 64)
    @Schema(description = "教学视频类型选择")
    private String videoTutorialType;

    @Column(length = 64)
    @Schema(description = "实验分数")
    private String score;

    @Column(length = 64)
    @Schema(description = "实验数据")
    private String experimentResult;


    @Column
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    @JsonCodec
    @Schema(description = "选择试题")
    private List<String> questionId;


    @Column(updatable = false)
    @DefaultValue(generator = Generators.CURRENT_TIME)
    private Date createTime;

    @Column
    @DefaultValue(generator = Generators.CURRENT_TIME)
    private Date updateTime;


}
